<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
         deferredSyntaxAllowedAsLiteral="true" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>航班修改</title>

    <script type="text/javascript" src="../js/jquery-3.4.1/jquery-3.4.1.js"></script>
    <script type="text/javascript" src="../js/bootstrap-4.4.1-dist/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" href="../js/bootstrap-4.4.1-dist/css/bootstrap.min.css">

    <style type="text/css">
        .card {
            width: 95%;
            margin: 0 auto;
        }

        .card-body {
            width: 50%;
            margin: 0 auto;
        }
    </style>

    <script type="text/javascript">
        $(function () {
            $("form").submit(function () {
                var flightStartTime = $("#flightStartTime").val();
                if (flightStartTime == "") {
                    alert("空数据");
                    return false;
                }
            });
        });
    </script>

</head>
<body>
<div class="card shadow">
    <div class="card-body">
        <form action="updateFlight.do" method="post">
            <div class="form-group">
                <label for="flightId">航班ID：</label>
                <input type="text" class="form-control" name="flightId" id="flightId" readonly="readonly"
                       value="${flight.flightId }">
            </div>
            <div class="form-group">
                <label for="flightStartTime">航班起飞时间：</label>
                <input type="text" readonly="readonly" class="form-control" id="flightStartTime"
                       onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'%y-%M-%d #{%H+1}:%m:%s'})"
                       required="required" name="flightStartTime" value="${flight.flightStartTime }">
            </div>
            <div class="form-group">
                <label for="flightPrice">航班价格：</label>
                <input type="text" class="form-control" name="flightPrice" id="flightPrice" required="required"
                       value="${flight.flightPrice}">
            </div>
            <div class="form-group">
                <button type="submit" class="btn btn-success">修改</button>
                <button type="button" class="btn btn-secondary" onclick="goBack()">返回</button>
            </div>
        </form>
    </div>
</div>
<c:if test="${msg!=null }">
    <script type="text/javascript">
        alert("${msg}");
    </script>
</c:if>
</body>

<script type="text/javascript">
    function goBack() {
        location.href = "selectFlightByPage.do";
        //window.history.back();
    }
</script>
</html>